home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / netzwerk / tcp-ip / ipdial_v1.9 / strreadargs.c < prev    next >
C/C++ Source or Header  |  1996-02-26  |  2KB  |  85 lines

  1. /**
  2. ***  IPDial     Script program for initializing a SLIP connection
  3. ***  Copyright  (C)   1994    Jochen Wiedmann
  4. ***
  5. ***  This program is free software; you can redistribute it and/or modify
  6. ***  it under the terms of the GNU General Public License as published by
  7. ***  the Free Software Foundation; either version 2 of the License, or
  8. ***  (at your option) any later version.
  9. ***
  10. ***  This program is distributed in the hope that it will be useful,
  11. ***  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ***  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. ***  GNU General Public License for more details.
  14. ***
  15. ***  You should have received a copy of the GNU General Public License
  16. ***  along with this program; if not, write to the Free Software
  17. ***  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. ***
  19. ***
  20. ***
  21. ***  This file implements a version of ReadArgs(), which parses strings
  22. ***  instead of the command line. However, its data is static, you must
  23. ***  not use it twice at the same time.
  24. ***
  25. ***
  26. ***  Computer: Amiga 1200                       Compiler: Dice 3.01
  27. ***
  28. ***  Author:    Jochen Wiedmann
  29. ***             Am Eisteich 9
  30. ***             72555 Metzingen
  31. ***             Germany
  32. ***
  33. ***             Phone: (+0049) 7123 / 14881
  34. ***             Internet: wiedmann@neckar-alb.de
  35. **/
  36. /**
  37. ***  Include files
  38. **/
  39. #ifndef IPDIAL_H
  40. #include "IPDial.h"
  41. #endif
  42. #include <dos/rdargs.h>
  43. /**
  44. ***  Local variables
  45. **/
  46. STATIC struct RDArgs *StrRDArgs     = NULL;
  47.  
  48. VOID StrReadArgsFree(VOID)
  49.   if (StrRDArgs)
  50.   { 
  51.     FreeArgs(StrRDArgs);
  52.     StrRDArgs = NULL;
  53.   }
  54. }
  55. ULONG StrReadArgs(STRPTR str, LONG *args, STRPTR templat)
  56.   STATIC struct RDArgs rdargs;
  57. /*
  58.   if(VerboseMode)
  59.     printf("StrReadArgs: str %s args %d template %s\n",str,*args,templat);
  60. */    
  61.   StrReadArgsFree();
  62.  
  63.   rdargs.RDA_Source.CS_Buffer = str;
  64.   rdargs.RDA_Source.CS_Length = strlen((char *) str);
  65.   rdargs.RDA_Source.CS_CurChr = 0;
  66.   rdargs.RDA_DAList = 0;
  67.   rdargs.RDA_Buffer = NULL;
  68.   rdargs.RDA_BufSiz = 0;
  69.   rdargs.RDA_ExtHelp = NULL;
  70.   rdargs.RDA_Flags = RDAF_NOPROMPT;
  71.  
  72.   StrRDArgs = ReadArgs(templat, args, &rdargs);
  73. /*   
  74.   if(VerboseMode)
  75.   {
  76.     printf("StrReadArgs: str %s args %x %s rdargs %s\n",str,args,*args,
  77.             StrRDArgs->RDA_Source.CS_Buffer);
  78.     fflush(stdout);
  79.   }
  80. */    
  81.    return((ULONG) (StrRDArgs ? TRUE : FALSE));
  82. }
  83.